﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;

namespace TestNetworkStream
{
    public class Client
    {
        private static bool same;

        public static void Run()
        {
            TcpClient tcpcl = new TcpClient();

            tcpcl.Connect(new IPEndPoint(IPAddress.Loopback, 5678));

            NetworkStream outs = tcpcl.GetStream();
            NetworkStream ins = tcpcl.GetStream();

            BinaryWriter bw = new BinaryWriter(outs);
            string outMsg = "0123456789";
            bw.Write(outMsg);
            bw.Close();

            BinaryReader br = new BinaryReader(ins);
            string inMsg = br.ReadString();
            br.Close();

            Console.WriteLine("Server returned: {0}", inMsg);
        }
    }
}
